package com.server.commons.minio.config;

import io.minio.MinioClient;
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Getter
@Setter
@Configuration
@ConfigurationProperties(prefix = "file-config.minio",ignoreInvalidFields = true,ignoreUnknownFields = true)
public class MinioConfig {

    /**
     * 用户名
     * @author LXC
     * @date 2022/5/7 13:55
     */
    private String accessKey;

    /**
     * 密码
     * @author LXC
     * @date 2022/5/7 13:55
     */
    private String secretKey;

    /**
     * minio地址
     * @author LXC
     * @date 2022/5/7 13:55
     */
    private String endPoint;

    @Bean
    public MinioClient getMinioClient(){
        return MinioClient.builder()
                .endpoint(endPoint)
                .credentials(accessKey, secretKey).build();
    }


}
